package com.yiqi.news.mvp.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yiqi.news.R
import com.yiqi.news.app.utils.TimeUtils
import com.yiqi.news.entity.GoldRecord
import kotlinx.android.synthetic.main.item_coins_record.view.*

class CoinsAdapter : BaseQuickAdapter<GoldRecord, BaseViewHolder>(R.layout.item_coins_record) {

    override fun convert(helper: BaseViewHolder, item: GoldRecord) {
        val itemView = helper.itemView
        when (item.changeType) {
            1 -> itemView.tv_type.text = "阅读收益"
            2 -> itemView.tv_type.text = "申请提现"
            3 -> itemView.tv_type.text = "提现失败"
            4 -> itemView.tv_type.text = "签到"
            5 -> itemView.tv_type.text = "在线收益"
        }
        itemView.tv_time.text = TimeUtils.stampToDate(item.createTime)
        itemView.tv_money.text = if (item.goldChange > 0) "+${item.goldChange}金币" else "${item.goldChange}金币"

    }
}